﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TfsAlert.Core.WorkflowServices
{
	public class RelayService : IRelayService
	{
        private int _relayPort;
        public Guid InstanceId { get; set; }

        public RelayService( int relayPort )
        {
            _relayPort = relayPort;
        }

        public void RelayOn()
        {
            EventHandler<RelayMessageArgs> relayOn = this.OnRelayOn;
            if ( relayOn != null )
                relayOn( null, new RelayMessageArgs(this.InstanceId, this._relayPort));
        }

        public void RelayOff()
        {
            EventHandler<RelayMessageArgs> relayOff = this.OnRelayOff;
            if ( relayOff != null )
                relayOff( null, new RelayMessageArgs(this.InstanceId, this._relayPort));
        }
        
        #region IRelayService Members

        public event EventHandler<RelayMessageArgs> OnRelayOn;
        public event EventHandler<RelayMessageArgs> OnRelayOff;

        #endregion
    }
}
